import { Controller, Get, UseGuards } from '@nestjs/common';
import { NewsService } from '../../service/news/news.service';
import { AuthGuard } from '../../../../guard/auth/auth.guard';

@Controller('admin/news')
// @UseGuards(AuthGuard) // 配置守卫，整个控制器都需要进行权限判断
export class NewsController {
  constructor(private readonly newsService: NewsService) {}

  @Get()
  @UseGuards(AuthGuard) // 对当前的路由进行守卫，不会对全局产生影响
  index() {
    console.log(this.newsService.getData());

    return '我是admin模块中的news 控制器';
  }

  @Get('add')
  AddNews() {
    return '新闻add页面';
  }
}
